import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  // 自动重定向到登陆页面
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    // 路由懒加载
    component: () => import('@/components/Login')
  },
  {
    path: '/home',
    component: () => import('@/components/Home'),
    redirect:'/welcome',
    children: [
      {
        path:'/welcome',
        component:() => import('@/components/welcome')
      },
      {
        path:'/users',
        component:() => import('@/components/user/user')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
